# 学习基本的数据类型

# 数字
# number1 = 1000
# number2 = 123.45
# number3 = 5
# print(number1 + number2)
# print(number1 - number2)
# print(number1 * number2)
# print(number1 / number2)
# print(number2 % number3)   # 3.450000000000003
# print(number3 ** 3)        # 次方运算
# print(number2 // number3)  # 整除运算
#
# number1 /= 5   # -> number1 = number1 + 5
# print(number1)


# 字符串
# string1 = "HelloWorld"
# string2 = "Woniuxy"
# string3 = "HelloChengDu"
#
# print(string1 + string2)
# print(string1[0])
# print(string3[2:5])     # 从下标2开始，到下标4结束， 左闭右开
# print(string2[-1])      # 取最后一个字符，如果为-2，则取倒数第2个
# print(string3[2:9:3])   # 步进长度
# print(string3[2::3])
# print(string3[::3])
# print(string3[::-1])


# 布尔
# boolean1 = 5 > 3
# print(boolean1)     # True
# boolean2 = 5 > 3 and 5 <= 10
# print(boolean2)
# boolean3 = 5 == 5 or 6 != 7
# print(boolean3)


# 列表
# list1 = [11, 22, 33, 44, 55, 66, 77, 77, 66, 'Hello', True, 123.45]   # 定义并赋值
# print(list1)
# print(list1[7])
# print(list1[2:5])
# print(list1[::-1])
# list1[3] = 88
# print(list1)
# del(list1[6])       # del函数用于删除一个变量或一个值，甚至一个对象
# print(list1)
# # del(list1)
# # print(list1[2])
#
# print("===========================")
#
# list2 = []      # 只定义，不赋值
# print(list2)
# list2.append(111)
# list2.append(222)
# list2.append(333)
# list2.append(444)
# list2.append(555)
# print(list2)
# # list2.clear()
# # print(list2)
# list2.remove(222)
# print(list2)
# print(len(list2))   # 用len可以对列表，元组，字符串等求长度


# 元组，与列表拥有几乎一样的用法：不能修改，不能删除
# tuple1 = (11, 22, 33, 44, 55, 66, 77, 'Hello', True, 123.45)
# print(tuple1[3])
# print(tuple1[3:7])
# print(tuple1[::-1])
# tuple1[3] = 88
# del(tuple1[3])


# 字典：利用Key-Value(键值对)来保存一组数据  <input type='button' value='ok'/>  <teacher name='qiang' age='18' height='185'>
# teacher = {'name':'qiang', 'age':18, 'height':185, 'sex':'man'}
# print(teacher['name'])
# print(teacher.get('height'))
# print(teacher.keys())
# print(teacher.values())


# 集合：交，并，差，非
# 随机排列，不允许重复，
# set1 = {11, 22, 33, 44, 55}
# set2 = {5, 9, 22, 33, 50, 77, 66}
# print(set1)
# print(set2)
# print(set1 | set2)  # 并集
# print(set1 & set2)  # 交集
# print(set2 - set1)  # 差集
# print(set1 ^ set2)  # 非
#
#
# n1 = 12345.6
# s1 = "hello"
# l1 = [1,2,3]
# set3 = {1,2,3}
# t1 = (1,2,3)
# print(type(n1))
# print(type(s1))
# print(type(t1))


# str = '1234.5'
# print(str.isnumeric())

# x = 100
# y = 200

# x, y = (100, 200)
# print(x, y)



# user_list = [['hello', '111', '13812345678'], ['woniu', '222', '18822345634'], ['good', '333', '15822345699'], []]
# print(user_list)
# print(user_list[1])
# print(user_list[1][2])
# print(len(user_list))
#
# pass_list = ['hello', '111', '13812345678']
# # print(user_list.index('woniu'))
# print(pass_list.index('111'))
#
# print('hello' in pass_list)



# user_dict1 = {'username':'qiang', 'password':'23456', 'phone':'18812345678', 'balance':3000}
# print(user_dict1.values())
# print(user_dict1.keys())
#
# for key in user_dict1.keys():
#     print(key + '-->' + str(user_dict1[key]))
#
#
# user_list = []
# user_list.append(user_dict1)
#
# user_dict2 = {}
# user_dict2['username'] = 'woniu'    # 如果字典中没有该key，则新增，如果已经存在该key，则修改
# user_dict2['password'] = '123456'
# user_dict2['phone'] = '15612342345'
# user_dict2['balance'] = 3500
#
# user_list.append(user_dict2)
#
#
# user_info = user_list[1]
# user_info['balance'] += 300
# user_list[1] = user_info
#
# print(user_info)
# print(user_list)


# import time
#
# print(time.time())
# print(int(time.time() * 1000000))
# print(time.localtime())
# print(time.asctime())
# print(time.strftime('%Y-%m-%d %H:%M:%S'))
#
#
# string = 'woniu 2018-11-17 10:50:30 取款 500##woniu 2018-11-17 10:50:30 存款 300##woniu 2018-11-17 10:50:30 转账 1500'
# print(string.split("##"))
#
#
# import random
# print(random.randint(100, 200))
# print(random.randrange(100, 1000, 100))


# mylist = [100, 200, 300, 400, 500]
# mydict = {}
# mytuple = (1200,)     # 如果是元组对象且里面只有一个值的话，必须在后面加逗号，才能够被正常地处理为元组对象，否则将被处理为普通数据。
# myset = set()
#
# # mylist.append('Hello')
# # print(len(mylist))
# print(len(mytuple))
#
# # print(mylist[0])
# print(mytuple[0])
#
# print(mylist[-1])


import pickle as p

# string = '4567:如果是元组对象且里面只有一个值的话，必须在后面加逗号，才能够被正常地处理为元组对象，否则将被处理为普通数据.'
# with open("D:/bin.data", mode="wb") as file:
#     p.dump(string, file)

# with open("D:/bin.data", mode="rb") as file:
#     print(p.load(file))

# import subprocess, os
# result = os.popen('tasklist | grep mysqld.exe').readlines()
# print(result[0].replace(' ', '', 20))


mylist = [100, 200, 300, 400, 500]
mydict = {'username':'qiang', 111:'23456', 'phone':mylist, True:3000}
print(type(mydict['phone']))
print(mydict[True])
print(mydict[111])
print(mydict[mylist])


